package com.atguigu.pojo;

import java.math.BigDecimal;
/**
 * 对象：
 * 1.Book           id/name/author/price/sales/stock/imgpth                                           【数据库里查到的商品】
 * 2.Cart           Map类型(商品属性)、addItem、deleteItem、clean(清空购物车)、updateCount(修改商品数量)   【购物车对象--一些属性--大对象】
 * 3.CartItem       id/name/count/price/totalPrice                                                    【购物车列表--基础】
 * 4.Order          orderId/createTime/price/status/userId                                            【创建订单--t_order】
 * 5.OrderItem      id/name/count/price/totalPrice/orderId                                            【订单项每一项都保存--t_order_item】
 * 6.Page           PAGE_SIZE/pageNo/pageTotal/pageSize/pageTotalCount/items/url                        【页码】
 * 7.User           id/username/password/email                                                          【用户信息】
 * */
public class Book {
    private Integer id;
    private String name;
    private String author;
    private BigDecimal price;
    private Integer sales;
    private Integer stock;
    private String imgPath = "static/img/default.jpg";

    public Book() {
    }

    public Book(Integer id, String name, String author, BigDecimal price, Integer sales, Integer stock, String imgPath) {
        this.id = id;
        this.name = name;
        this.author = author;
        this.price = price;
        this.sales = sales;
        this.stock = stock;
        // 要求给定的图书封面图书路径不能为空
        if (imgPath != null && !"".equals(imgPath)) {
            this.imgPath = imgPath;
        }

    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public Integer getSales() {
        return sales;
    }

    public void setSales(Integer sales) {
        this.sales = sales;
    }

    public Integer getStock() {
        return stock;
    }

    public void setStock(Integer stock) {
        this.stock = stock;
    }

    public String getImgPath() {
        return imgPath;
    }

    public void setImgPath(String imgPath) {
        // 要求给定的图书封面图书路径不能为空
        if (imgPath != null && !"".equals(imgPath)) {
            this.imgPath = imgPath;
        }
    }


    @Override
    public String toString() {
        return "Book{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", author='" + author + '\'' +
                ", price=" + price +
                ", sales=" + sales +
                ", stock=" + stock +
                ", imgPath='" + imgPath + '\'' +
                '}';
    }
}
